﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="WorkFlow_WFDesigner_OtherTransactorAdd" Codebehind="OtherTransactorAdd.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>特殊指派</title>
    <base target="_self" />
   <meta http-equiv="Pragma" content="no-cache" />
   <meta http-equiv="Cache-Control" content="no-cache"/>
   <meta http-equiv="Expires" content="0"/> 
   <link href="../Styles/control.css" rel="stylesheet" type="text/css" />
   <link href="../css/tab/tab.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../css/tab/tab.js"></script>
    <script language="javascript" type="text/javascript" src="../js/GridCheckBox.js"></script>
</head>
<body onload="IniSelect()">
    <form id="form1" runat="server">
    <div class="page_margin" style="margin:5px"> 
  <div class="nTab_l">

    <div class="TabTitle_l">
      <ul id="myTab_l">     
        <li id='li0' class="active" onclick="nTabs(this,0);">前驱环节人员</li>
        <li id='li1' class="normal" onclick="nTabs(this,1);">特殊人员</li>
      </ul>
    </div>

    <div class="TabContent_l" style="height:420px;overflow-y:hidden">
    
        <div id="myTab_l_Content0" style="overflow-y:scroll;overflow-x:hidden;height:400px;" >            
            <table width="98%"  border="1" cellspacing="0" cellpadding="1" class="t1">
              <thead>
                <th style="width:30px" align="center" >
                    <input type="checkbox" id="chkAll" name="chkAll" value="checkbox" onclick='javascript:mCheckAll(this,"chkID")' />
                </th>
                <th align="center">人工环节名称</th>
                <th align="center">描述</th>
                <th align="center" style="width:80px" >人员类型</th>
              </thead>
              <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
              <ItemTemplate>
              <tr>
                <td align="center" >
                    <input type="checkbox" name="chkID" id="chk<%# DataBinder.Eval(Container.DataItem,"ID") %>"  value="<%# DataBinder.Eval(Container.DataItem,"ID") %>" >
                </td>
                <td align="left"><%# DataBinder.Eval(Container.DataItem,"Name") %><input type="hidden" id="hi<%# DataBinder.Eval(Container.DataItem,"ID") %>" value="<%# DataBinder.Eval(Container.DataItem,"Name") %>" /></td>    
                <td align="left"><%# DataBinder.Eval(Container.DataItem,"Description") %></td>    
                <td align="center"><select name="ddlID" id="ddl<%# DataBinder.Eval(Container.DataItem,"ID") %>" class="input2">
                                    <option value="101610">第一人</option>
                                    <option selected="selected"  value="101611">最后一人</option>
                                    <option value="101612">所有人</option>
                                    </select> </td>
              </tr>  
              </ItemTemplate>
              </asp:Repeater>
            </table>
        </div>
        
        <div id="myTab_l_Content1" class="none" >            
            <asp:CheckBox ID="chkDraftOut" runat="server" Text="起草人(流程启动者)" /><br />
            <asp:CheckBox ID="chkRequirer" runat="server" Text="发送人(发送给本环节人员)" /><br />            
            <asp:CheckBox ID="chkDraftOutDep" runat="server" Text="起草人部门成员" /><br />
            <asp:CheckBox ID="chkRequirerDep" runat="server" Text="发送人部门成员" /><br />
            <asp:CheckBox ID="chkOnTransact" runat="server" Text="处理时指定(从组织机构里面任意选择)" /><br />
            <asp:CheckBox ID="chkDraftOutDepManage" runat="server" Text="起草人部门主管" Visible="false" /><br />
            <asp:CheckBox ID="chkRequirerDepManage" runat="server" Text="发送人部门主管" Visible="false" /><br />
            <asp:HiddenField ID="hiPreAct" runat="server" />
        </div>
    </div>

  </div>
</div>    
        
<table width="100%"  border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td align="center">
        
        <asp:Button ID="btnSave" Text = "确定" runat="server"  OnClientClick="GetReturn();return false;" OnClick="btnSave_Click" class="btn_normal" 
                onmouseover="this.className='btn_active'" 
                onmouseout="this.className='btn_normal'" />
        <asp:Button ID="btnExit" Text = "退出" runat="server" OnClientClick="window.close();" class="btn_normal" 
                onmouseover="this.className='btn_active'" 
                onmouseout="this.className='btn_normal'" />
    </td>
  </tr>
</table>
    </form>
    <script language="javascript" type="text/javascript">
        function GetReturn() {
            var chkArr = document.getElementsByName("chkID");
            var iLength = 0;
            for (i = 0; i < chkArr.length; i++) {
                if (chkArr[i].checked) { iLength++; }
            }
            if (document.getElementById("<%=chkDraftOut.ClientID %>").checked) { iLength++; }
            if (document.getElementById("<%=chkRequirer.ClientID %>").checked) { iLength++; }
            if (document.getElementById("<%=chkDraftOutDep.ClientID %>").checked) { iLength++; }
            if (document.getElementById("<%=chkRequirerDep.ClientID %>").checked) { iLength++; }
            if (document.getElementById("<%=chkOnTransact.ClientID %>").checked) { iLength++; }
            var RetArr = new Array(iLength);
            var data;
            var j = 0;
            for (i = 0; i < chkArr.length; i++) {
                if (chkArr[i].checked) {
                    var ddl = document.getElementById("ddl" + chkArr[i].value);
                    var hi = document.getElementById("hi" + chkArr[i].value);
                    data = new OtherData();
                    data.Type = ddl.value;
                    data.ID = chkArr[i].value;
                    data.Name = hi.value;
                    RetArr[j] = data;
                    j++;
                }
            }
            if (document.getElementById("<%=chkDraftOut.ClientID %>").checked) {
                data = new OtherData();
                data.Type = "101606";
                RetArr[j] = data;
                j++;
            }
            if (document.getElementById("<%=chkRequirer.ClientID %>").checked) {
                data = new OtherData();
                data.Type = "101607";
                RetArr[j] = data;
                j++;
            }
            if (document.getElementById("<%=chkDraftOutDep.ClientID %>").checked) {
                data = new OtherData();
                data.Type = "101608";
                RetArr[j] = data;
                j++;
            }
            if (document.getElementById("<%=chkRequirerDep.ClientID %>").checked) {
                data = new OtherData();
                data.Type = "101609";
                RetArr[j] = data;
                j++;
            }
            if (document.getElementById("<%=chkOnTransact.ClientID %>").checked) {
                data = new OtherData();
                data.Type = "101613";
                RetArr[j] = data;
                j++;
            }
            window.returnValue = RetArr;
            window.close();
        }
        function OtherData() {
            var Type;
            var ID;
            var Name;
        }
        function IniSelect() {
            var cvalue = window.parent.window.dialogArguments;
            var preActStr = "";
            if (cvalue != null) {
                for (var i = 0; i < cvalue.length; i++) {
                    if (cvalue[i].Type == "101606") {//起草人
                        document.getElementById("<%=chkDraftOut.ClientID %>").checked = true;
                        document.getElementById("<%=chkDraftOut.ClientID %>").disabled = true;
                    }
                    else if (cvalue[i].Type == "101607") {//发送人
                        document.getElementById("<%=chkRequirer.ClientID %>").checked = true;
                        document.getElementById("<%=chkRequirer.ClientID %>").disabled = true;
                    }
                    else if (cvalue[i].Type == "101608") {//起草人部门成员
                        document.getElementById("<%=chkDraftOutDep.ClientID %>").checked = true;
                        document.getElementById("<%=chkDraftOutDep.ClientID %>").disabled = true;
                    }
                    else if (cvalue[i].Type == "101609") {//发送人部门成员
                        document.getElementById("<%=chkRequirerDep.ClientID %>").checked = true;
                        document.getElementById("<%=chkRequirerDep.ClientID %>").disabled = true;
                    }
                    else if (cvalue[i].Type == "101613") {//处理时指定
                        document.getElementById("<%=chkOnTransact.ClientID %>").checked = true;
                        document.getElementById("<%=chkOnTransact.ClientID %>").disabled = true;
                    }
                    else {
                        document.getElementById("chkAll").disabled = true;
                        document.getElementById('chk' + cvalue[i].ID).checked = true;
                        document.getElementById('chk' + cvalue[i].ID).disabled = true;
                        document.getElementById('ddl' + cvalue[i].ID).disabled = true;
                        if (preActStr == "") { preActStr = cvalue[i].Type + "|" + cvalue[i].ID + "|" + cvalue[i].Name; }
                        else { preActStr += "," + cvalue[i].Type + "|" + cvalue[i].ID + "|" + cvalue[i].Name; }
                    }
                }
            }
        }    
    </script>
</body>
</html>
